import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Params } from '@angular/router';
import { AuthService } from 'src/app/services/auth.service';
import { ToastService } from 'src/app/providers/toast/toast.service';
import * as constants from '../../../providers/Constants'
import { OrderService } from 'src/app/services/order.service';
import { Storage } from 'src/app/providers/Storage';
import { NavController } from '@ionic/angular';
@Component({
  selector: 'app-pay-status',
  templateUrl: './pay-status.page.html',
  styleUrls: ['./pay-status.page.scss'],
})
export class PayStatusPage implements OnInit {
  payToast:string='Payment proceed successfully';
  payType:boolean=true;
  dataInfo:any={};
  allPrice:string='';
  constructor(private nav: NavController,  private activeRoute: ActivatedRoute,  private toast: ToastService) {
    this.activeRoute.queryParams.subscribe((params: Params) => {
        if (params.status==0) {  //成功
          this.payToast='successfully'
          this.payType==true;
        }else{
          this.payType==false;
          this.payToast='Payment proceed failure'  
        }
        this.allPrice=params.allPrice;
        console.log(params.allPrice);
        this.dataInfo=JSON.parse(params.resInfo);
    })
  }

  ngOnInit() {
  }
  btn(type){
    if (type==0) {
      this.nav.navigateRoot('tabs/tab1');
    }else{
      this.nav.navigateBack('order-list',{
        queryParams:{
          orderType:10
        }
      });
    }
  }
}
